package com.zemb.flxwear.UI.Activity;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import androidx.appcompat.app.AppCompatActivity;

import com.zemb.flxwear.Define.AppConst;
import com.zemb.flxwear.R;
import com.zemb.flxwear.Utils.IMEI;
import com.zemb.flxwear.Utils.QRCodeUtil;

public class QrActivity extends AppCompatActivity {
    ImageView qr;
    IMEI imei;
    String s_imei="";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_qractivity);
        imei = new IMEI();
        qr = findViewById(R.id.iv_qr);
        s_imei = imei.getDeviceId(this);
        new Thread(new Runnable() {
            @Override
            public void run() {
                final Bitmap bitmap = QRCodeUtil.createQRCodeBitmap(AppConst.QRUrl+"&imei="+ s_imei,300,300);
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        qr.setImageBitmap(bitmap);
                    }
                });

            }
        }).start();
    }
}
